$("#Switchbox", window.parent.parent.document).on("click", function () {
    ModeSwitch.modeSwitch();
    commonbgcolor();
    markbgcolor();
})

//自适应高度(iframe加载完毕后调用)
function infoiframeOn() {
    var iframeObj = document.getElementById('darkMode');

    $('#personal_info', window.parent.document).css('height', iframeObj.scrollHeight);

    setTimeout(() => {
        window.parent.iframeOn('homepage');
    })
}

function personal_info() {
    $.ajax({
        sync: false,
        type: 'GET',
        dataType: 'json',
        url: 'https://gitee.com/api/v5/repos/' + giteeID + '/mweb/contents/homepage.html',
        success: function (result) {
            var data = utf8to16(window.atob(result.content));

            document.getElementById('darkMode').innerHTML = data.match(/<[\s]*section[\s]+class[\s]*=[\s]*"ct-body"[\s]*>.*<[\s]*[\/][\s]*section[\s]*>/gs)[0].replaceAll('media', 'https://gitee.com/' + giteeID + '/mweb/raw/master/media').replaceAll('<img src=', '<img onload="iframeOn("infohomepage")" src=').replaceAll('class="title"', '');
            setTimeout(() => {
                infoiframeOn();
                $('#personal_info', window.parent.document).css('height', $('.ct-body').Height)
            })
        }
    })
}

